<template>
  <view class="note-item" @click="handleEdit">
    <view class="datetime">
      {{ data.createTime }}
    </view>
    <view class="note-content">
      {{ data.remark }}
    </view>
    <view class="related-question">
      <u-tag :text="text" />
      <text class="related-question-content">{{ data.questionDetail.titleContent }}</text>
    </view>
  </view>
</template>

<script>
import config from '@/uni_modules/sv-exam-plus/config.js'

export default {
  props: {
    data: {
      type: Object,
      default: () => ({}),
    },
  },
  computed: {
    text() {
      const type = this.data.questionDetail && this.data.questionDetail.questionType;
      return config.paperTypeDict[type];
    }
  },
  methods: {
    handleEdit() {
      console.log(config)
        this.$emit('edit', this.data);
    }
  }
};
</script>
<style lang="scss" scoped>
.note-item {
  padding: 12px;
  .datetime {
    color: #999;
  }
  .note-content {
    font-size: 14px;
    color: #000;
    margin: 6px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .related-question {
    font-size: 12px;
    background-color: #eee;
    padding: 4px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    .related-question-content {
      padding-left: 6px;
    }
  }
}
</style>
